package com.owc.controller.admin;

import com.owc.common.custom.annotation.Advice;
import com.owc.domain.BaseResult;
import com.owc.domain.PageBean;
import com.owc.domain.dto.admin.ExchangeOrderDTO;
import com.owc.domain.dto.admin.WealthDTO;
import com.owc.domain.vo.admin.ExchangeQueryVo;
import com.owc.domain.vo.admin.ProxyBuyVo;
import com.owc.domain.vo.admin.WealthQueryVo;
import com.owc.service.admin.WealthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping(value = "/admin/wealth")
@Api(tags = "(manage-V2)财务管理")
public class WealthController {

    private final WealthService wealthService;

    public WealthController(WealthService wealthService) {
        this.wealthService = wealthService;
    }

    @PostMapping(value = "/getWealthOrderList")
    @ApiOperation("获取理财订单列表")
    public BaseResult<PageBean<WealthDTO>> getWealthOrderList(@RequestBody WealthQueryVo wealthQueryVo){
        return BaseResult.success(wealthService.getWealthOrderList(wealthQueryVo));
    }

    @PostMapping(value = "/proxyBuy")
    @ApiOperation("代理下单")
    public BaseResult<Boolean> proxyBuy(@RequestBody @Valid ProxyBuyVo proxyBuyVo){
        return BaseResult.success(wealthService.proxyBuy(proxyBuyVo));
    }

    @PostMapping(value = "/getExchangeOrderList")
    @ApiOperation("获取兑换订单列表")
    public BaseResult<PageBean<ExchangeOrderDTO>> getExchangeOrderList(@RequestBody ExchangeQueryVo exchangeQueryVo){
        return BaseResult.success(wealthService.getExchangeOrderList(exchangeQueryVo));
    }

}
